package org.flashbrighton.as3bots.bots
{	
	import flash.display.Sprite;
	import org.flashbrighton.as3bots.components.*;
	import org.flashbrighton.as3bots.models.BotModel;
		
	public class BaseBot
	{
		public var botName:String;
		public var size:String;
		public var colour:Number;
		public var skin:Sprite;
		
		private var _controller:IBotController;		
		private var _components:Array;
		
		
		public function BaseBot()
		{
			_components = new Array();
			addEssentialComponents();
			setDefaults();
		}
		
		
		final public function addController(controller:IBotController):void
		{
			_controller = controller;
		}
		
		
		final public function addComponent(name:String):void
		{
			if (_components.length == ComponentManager.MAX_NUM) return;
			if (_components.indexOf(name) > -1) return;
			
			_components.push(name);
		}
		
		
		final public function get components():Array
		{
			return _components;
		}
		
		
		final public function get controller():IBotController
		{
			return _controller;
		}
		
		
		private function addEssentialComponents():void
		{
			addComponent(ComponentNames.ENGINE);
			addComponent(ComponentNames.STEERING);
			addComponent(ComponentNames.HEALTH);
			addComponent(ComponentNames.CHASSIS);
		}
		
		
		private function setDefaults():void
		{
			botName = "anon";
			size = ChassisSize.MEDIUM;
			colour = 0xFFFFFF;
		}
		
	}
}